<?php

  include_once 'common/function.inc.php';
  include_once 'common/config.inc.php';

  //1.接收参数
  $id = isset($_GET['id'])?intval($_GET['id']):'';

  //2.判断id是否为空
  if(empty($id)){

    _alert_back('参数异常!');

  }
  //3.连接数据库
  include_once 'common/mysql.inc.php';

  $sql = "select * from bbs_news WHERE id=$id limit 1";
  $res = @mysql_query($sql);

  $row = mysql_fetch_assoc($res);
  //var_dump($row);die();


?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加动态</title>
<link href="Images/css1/css.css" rel="stylesheet" type="text/css">
<style>
td, th {
	text-align: center
}
</style>
</head>
<body>
<form method='post' action='news_deal.php' enctype='multipart/form-data'>
  <table class="table" cellspacing="1" cellpadding="2" width="99%"
			align="center" border="0">
    <tbody>
      <tr>
        <th style="text-align:left;" colspan="2" class="bg_tr" align="left" height="25">修改动态</th>
      </tr>
      <tr>
        <td style="text-align:right;" class="td_bg" width="17%" height="23" align="center">动态名称：</td>
        <td style="text-align:left;" class="td_bg">
        	<input type='text' name='title' value="<?php echo $row['title']?>"/>
        </td>
      </tr>
	  <tr>
        <td style="text-align:right;" class="td_bg" width="17%" height="23" align="center">所属类别：</td>
        <td style="text-align:left;" class="td_bg">
        	<select name='cid'>
            	<option value=''>请选择</option>
              <?php
                foreach($newstype as $k=>$v)
                {
              ?>
                 <option value='<?php echo $v[0]; ?>' <?php

                 if($v[0]==$row['cid']){
                   echo "selected";
                 }
                 ?> ><?php echo $v[1]; ?></option>

              <?php

                }
              ?>
           	</select>
        </td>
      </tr>
	  <tr>
        <td style="text-align:right;" class="td_bg" width="17%" height="23" align="center">动态描述：</td>
        <td style="text-align:left;" class="td_bg">
        	<textarea cols='40' rows='5' name='description'><?php echo $row['description']?></textarea>
        </td>
      </tr>
      <tr>
        <td style="text-align:right;" class="td_bg" width="17%" height="23" align="center">动态内容：</td>
        <td style="text-align:left;" class="td_bg">
          <textarea cols='60' rows='8' name='content'>
            <?php echo $row['content']; ?>
          </textarea>
        </td>
      </tr>
	  <tr>
        <td style="text-align:right;" class="td_bg" width="17%" height="23" align="center">&nbsp;</td>
        <td style="text-align:left;" class="td_bg">
        	<input type='hidden' name='act' value='edit' />
        	<input type='hidden' name='id' value='<?php echo $row['id']; ?>' />
        	<input type='submit' name='submit' value='提交' />
        </td>
      </tr>
    </tbody>
  </table>
</form>
</body>
</html>